package com.person.tag;

import java.util.List;
import javax.servlet.jsp.JspException;
import com.person.common.InitApplication;
import com.person.ntv.entity.sys.SysCode;

public class ViewTag extends BaseTag {
	private static final long serialVersionUID = 1L;
	private String codeSet;
	private String value;
	
	public String getCodeSet() {
		return codeSet;
	}

	public void setCodeSet(String codeSet) {
		this.codeSet = codeSet;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public void release() {
		super.release();
	}

	@Override
	public int doEndTag() throws JspException {
	    return EVAL_BODY_BUFFERED;
	}

	@Override
	public int doStartTag() throws JspException {
		 StringBuffer out = new StringBuffer("");
		 List<SysCode>list=InitApplication.codeMap.get(codeSet);
		 if(list!=null){
				for(SysCode sc:list){
					if(sc.getItemValue()!=null&&sc.getItemValue().equals(value)){
						out.append(sc.getItemName());
						break;
					}
				}
			}
		 TagUtils.write(pageContext, out.toString());
		 return EVAL_PAGE;
	}

}
